/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseItemDetailsEntity.cs
*        创建系统时间:       2012/11/2 19:07:02
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;
    using ECP.Utilities;

    [Serializable]
    public class BaseItemDetailsEntity
    {
        private bool allowDelete;
        private bool allowEdit;
        private string createDate;
        private string createUserID;
        private string description;
        private bool enabled;
        private string id;
        private bool isInput;
        private string itemCode;
        private string itemName;
        private string itemValue;
        private string modifyDate;
        private string modifyUserID;
        private string parentID;
        private string sortCode;

        public BaseItemDetailsEntity()
        {
            this.id = string.Empty;
            this.parentID = string.Empty;
            this.itemCode = string.Empty;
            this.itemName = string.Empty;
            this.itemValue = string.Empty;
            this.isInput = true;
            this.allowEdit = true;
            this.allowDelete = true;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
        }

        public BaseItemDetailsEntity(DataRow dataRow)
        {
            this.id = string.Empty;
            this.parentID = string.Empty;
            this.itemCode = string.Empty;
            this.itemName = string.Empty;
            this.itemValue = string.Empty;
            this.isInput = true;
            this.allowEdit = true;
            this.allowDelete = true;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(dataRow);
        }

        public BaseItemDetailsEntity(DataTable dataTable)
        {
            this.id = string.Empty;
            this.parentID = string.Empty;
            this.itemCode = string.Empty;
            this.itemName = string.Empty;
            this.itemValue = string.Empty;
            this.isInput = true;
            this.allowEdit = true;
            this.allowDelete = true;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(dataTable);
        }

        public BaseItemDetailsEntity GetFrom(DataRow dataRow)
        {
            this.ID = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldID]);
            this.ParentID = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldParentID]);
            this.ItemCode = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldItemCode]);
            this.ItemName = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldItemName]);
            this.ItemValue = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldItemValue]);
            this.IsInput = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseItemDetailsTable.FieldIsInput]);
            this.AllowEdit = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseItemDetailsTable.FieldAllowEdit]);
            this.AllowDelete = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseItemDetailsTable.FieldAllowDelete]);
            this.Enabled = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseItemDetailsTable.FieldEnabled]);
            this.SortCode = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldSortCode]);
            this.Description = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldDescription]);
            this.CreateUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldCreateUserID]);
            this.CreateDate = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldCreateDate]);
            this.ModifyUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldModifyUserID]);
            this.ModifyDate = BaseBusinessLogic.ConvertToString(dataRow[BaseItemDetailsTable.FieldModifyDate]);
            return this;
        }

        public BaseItemDetailsEntity GetFrom(DataTable dataTable)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }

        public bool AllowDelete
        {
            get
            {
                return this.allowDelete;
            }
            set
            {
                this.allowDelete = value;
            }
        }

        public bool AllowEdit
        {
            get
            {
                return this.allowEdit;
            }
            set
            {
                this.allowEdit = value;
            }
        }

        public string CreateDate
        {
            get
            {
                return this.createDate;
            }
            set
            {
                this.createDate = value;
            }
        }

        public string CreateUserID
        {
            get
            {
                return this.createUserID;
            }
            set
            {
                this.createUserID = value;
            }
        }

        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        public bool Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        public string ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public bool IsInput
        {
            get
            {
                return this.isInput;
            }
            set
            {
                this.isInput = value;
            }
        }

        public string ItemCode
        {
            get
            {
                return this.itemCode;
            }
            set
            {
                this.itemCode = value;
            }
        }

        public string ItemName
        {
            get
            {
                return this.itemName;
            }
            set
            {
                this.itemName = value;
            }
        }

        public string ItemValue
        {
            get
            {
                return this.itemValue;
            }
            set
            {
                this.itemValue = value;
            }
        }

        public string ModifyDate
        {
            get
            {
                return this.modifyDate;
            }
            set
            {
                this.modifyDate = value;
            }
        }

        public string ModifyUserID
        {
            get
            {
                return this.modifyUserID;
            }
            set
            {
                this.modifyUserID = value;
            }
        }

        public string ParentID
        {
            get
            {
                return this.parentID;
            }
            set
            {
                this.parentID = value;
            }
        }

        public string SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }
    }
}